import service from "@/utils/request"
import LoginWork from "@/utils/LoginWork" 

// 材料退货作业参数
export interface MaterialReturnOperationParms{
    mtlColor:string,
    mtlName:string,
    pageNum:number,
    pageSize:number,
    purLot:string,
    purNo:string,
    recNo:string,
    sendDateEnd:string,
    sendDateStart:string,
    typeNo:string,
    vendorName:string
} 

export interface MaterialDataSubjectInterface{
    total?: number,
    dtos: dtos[]
}

export interface dtos {
    slipType: string,
    sendDate: string,
    sendNo: null,
    purNo: null,
    vendorName: string,
    purLot: string,
    mtlColor: string,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    sendQty: number,
    returnQty: null,
    acceptQty: number,
    returnKgQty: null,
    returnNo: null,
    areason: null,
    acheckFlag: string,
    pcheckFlag: string
}

// 材料退货作业
export const MaterialReturnOperation = (parms:MaterialReturnOperationParms) => {
    return service.put<any,MaterialDataSubjectInterface>('/pcFactorStockQuery/getMtlRtCheckQuery',parms)
}

export interface MaterialManufacturerInterface {
    vendor: vendor[],
    slipType: slipType[]
}

export interface vendor{
    vendorNo: string,
    vendorName: string
}

export interface slipType{
    typeNo: string,
    typeName: string
}

// 厂商  分类数据
export const MaterialManufacturer = () => {
    return service.get<any,MaterialManufacturerInterface>('/pcFactorStockQuery/getMtlRtBackQuery')
}

export interface MaterialDefectInterface {
    mtlColor:string,
    mtlName:string,
    purLot:string,
    purNo:string,
    sendNo:string,
    vendorName:string
}

export interface MaterialDefectInterfaceIltc{
    detailDtos: detailDtos[]
    lotDtos: lotDtos[]
    qtyTotal: number
    sendTotal: number
    unSendTotal: number
}

export interface detailDtos{
    amt: string,
    kgQty: null,
    dyedFee: null,
    remark: string,
    mtlNo: string,
    recNo: null,
    vendorNo: string,
    preason: null
}

export interface lotDtos{
    lotDetail: string,
    sendQty: number,
    unSendQty: number,
    qty: number
}

export const MaterialDefect = (parms:MaterialDefectInterface) => {
    return service.put<any,MaterialDefectInterfaceIltc>('/pcFactorStockQuery/getMtlRtLotQuery',parms)
}

// 未检验查询 数据
export interface UntestedParameter{
    mtlColor:string,
    mtlName:string,
    pageNum:number,
    pageSize:number,
    purLot:string,
    purNo:string,
    recNo:string,
    sendDateEnd:string,
    sendDateStart:string,
    typeNo:string,
    vendorName:string
}

export interface UncheckedQueryInterface{
    total?: number,
    dtos: dtos[]
}

export interface dtos{
    sendDate: string,
    purNo: null,
    vendorNo: string,
    vendorName: string,
    purLot: string,
    mtlColor: string,
    mtlName: string,
    mtlSpec: string,
    mtlUnit: string,
    sendQty: number,
    returnQty: null,
    amt: number,
    kgQty: null,
    remark: string,
    recNo: null,
    recDate: string
}

export const UncheckedQuery = (parms:UntestedParameter) => {
    return service.put<any,UncheckedQueryInterface>('/pcFactorStockQuery/getMtlRtUnCheckQuery',parms)
}

// 退库批处理
export const  ReturnToBatchProcessing = (parms:any) => {
    return LoginWork.put<any,any>('/pcFactorStockQuery/MtlRtPcUpdate',parms)
}

